﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;


using PhotoViewerLib;

namespace PhotoViewerWeb
{
    public partial class WebForm2 : System.Web.UI.Page
    {

        private List<Category> categories;
        private List<Photo> photos;

        private Photo displayedPhoto;

        protected void Page_Load(object sender, EventArgs e)
        {
            categories = Util.getListCategory();
            photos = Util.getListPhotos();
            foreach (Category c in categories)
            {
                categLb.Items.Add(c.name);
//                categTV.Nodes.Add(new TreeNode(c.name, c.uid.ToString()));
//                categMenu.Items.Add(new MenuItem(c.name, c.uid.ToString()));
            }
        }
        protected void categMenu_MenuItemClick(object sender, MenuEventArgs e)
        {
            Category selected = Util.getCategoryById(e.Item.Value.ToString());
            if (selected != null)
            {
                this.Session.Add("selectedCategory", selected);
            }
        }

        protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
        {
            //Category selected = Util.getCategoryById(categTV.SelectedNode.Value.ToString());
            //if (selected != null)
            //{
            //    this.Session.Add("selectedCategory", selected);
            //}
        }

        protected void categLb_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
    }
}
